@model HouseMap.Dao.DBEntity.Notice
<!doctype html>
<html class="no-js">
<head>
  <meta charset="utf-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <title>新增/编辑公告</title>
  <meta name="keywords" content="table">
  <meta name="viewport" content="width=device-width, initial-scale=1">
  <meta name="renderer" content="webkit">
  <meta http-equiv="Cache-Control" content="no-siteapp" />
  <link rel="icon" type="image/png" href="~/assets/i/favicon.png">
  <link rel="apple-touch-icon-precomposed" href="~/assets/i/app-icon72x72@2x.png">
  <meta name="apple-mobile-web-app-title" content="Amaze UI" />
  <link rel="stylesheet" href="~/assets/css/amazeui.min.css"/>
  <link rel="stylesheet" href="~/assets/css/admin.css">
</head>
<body>
<!--[if lte IE 9]>
<p class="browsehappy">你正在使用<strong>过时</strong>的浏览器，Amaze UI 暂不支持。 请 <a href="http://browsehappy.com/" target="_blank">升级浏览器</a>
  以获得更好的体验！</p>
<![endif]-->

<header class="am-topbar am-topbar-inverse admin-header">
  <div class="am-topbar-brand">
    <strong>House-map.cn</strong> <small>后台管理</small>
  </div>

  <button class="am-topbar-btn am-topbar-toggle am-btn am-btn-sm am-btn-success am-show-sm-only" data-am-collapse="{target: '#topbar-collapse'}"><span class="am-sr-only">导航切换</span> <span class="am-icon-bars"></span></button>

  <div class="am-collapse am-topbar-collapse" id="topbar-collapse">
  </div>
</header>

<div class="am-cf admin-main">
  <!-- sidebar start -->
  <div class="admin-sidebar am-offcanvas" id="admin-offcanvas">
    <div class="am-offcanvas-bar admin-offcanvas-bar">
      <ul class="am-list admin-sidebar-list">
        <li><a href="#"><span class="am-icon-home"></span> 首页</a></li>
        <li><a href="~/Notices"><span class="am-icon-table"></span> 公告列表</a></li>
        <li><a href="#"><span class="am-icon-sign-out"></span> 注销</a></li>
      </ul>

      <div class="am-panel am-panel-default admin-sidebar-panel">
        <div class="am-panel-bd">
          <p><span class="am-icon-bookmark"></span> 公告</p>
          <p>时光静好，与君语；细水流年，与君同。—— Amaze UI</p>
        </div>
      </div>

      <div class="am-panel am-panel-default admin-sidebar-panel">
        <div class="am-panel-bd">
          <p><span class="am-icon-tag"></span> wiki</p>
          <p>Welcome to the Amaze UI wiki!</p>
        </div>
      </div>
    </div>
  </div>
  <!-- sidebar end -->

  <!-- content start -->
  <div class="admin-content">
    <div class="admin-content-body">
      <div class="am-cf am-padding am-padding-bottom-0">
        <div class="am-fl am-cf"><strong class="am-text-primary am-text-lg">新增/编辑公告</strong></div>
      </div>
      <hr>
       <!-- Include Quill stylesheet -->
      <link href="https://cdn.quilljs.com/1.0.0/quill.snow.css" rel="stylesheet">

      <!-- Create the toolbar container -->
      <div id="toolbar">
      </div>
      <div class="am-cf am-padding am-padding-bottom-0">
        <p>
          <label>结束展示日期：</label>
          <input id="endShowDate" type="text"/>      
          <button type="button" class="am-btn am-btn-primary am-round" id="btnSave">保存</button>
        </p>
      </div>


      <!-- Create the editor container -->
      <div id="editor">
        <p>@Model?.Content</p>
      </div>
      <br/>



      <!-- Include the Quill library -->
      <script src="https://cdn.quilljs.com/1.0.0/quill.js"></script>
      <script src="https://code.jquery.com/jquery-2.2.4.js"></script>
      <!--<![endif]-->
      <script src="~/assets/js/amazeui.min.js"></script>
      <script src="~/assets/js/app.js"></script>

      <!-- Initialize Quill editor -->
      <script>
        var editor = new Quill('#editor', {
          modules: {
            toolbar: [
            [{ header: [1, 2, false] }],
            ['bold', 'italic', 'underline','link'],
            ['code-block']
          ]},
          theme: 'snow'
        });
        var id = '@(Model?.Id!=null ? Model?.Id:0)'
        $("#endShowDate").val('@(Model?.Id!=null ? Model?.EndShowDate.ToString("yyyy-MM-dd"):"")');
        var saveNotice='../Notices/Save'
        $(function()
        {
          $('#btnSave').bind('click', function (e) {
            var $this = $(this);
            var content = $("#editor").text();
            var endDate =  $("#endShowDate").val();
            $.ajax({
                type: "post",
                url: saveNotice,
                data: { id: id, content:content, date:endDate},
                success:
                    function (result) {
                      console.log(result);
                      if(result.success)
                      {
                         window.location.href='../Notices';
                      }
                    }
            });
            });
        })
      </script>
    </div>

  </div>
  <!-- content end -->
</div>

<a href="#" class="am-icon-btn am-icon-th-list am-show-sm-only admin-menu" data-am-offcanvas="{target: '#admin-offcanvas'}"></a>

<!--[if lt IE 9]>
<script src="http://libs.baidu.com/jquery/1.11.1/jquery.min.js"></script>
<script src="http://cdn.staticfile.org/modernizr/2.8.3/modernizr.js"></script>
<script src="assets/js/amazeui.ie8polyfill.min.js"></script>
<![endif]-->

<!--[if (gte IE 9)|!(IE)]><!-->
</body>
</html>
